package no.monsen.client.ui;

import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;

import no.monsen.monsenservice.MonsenFact;

public class MonsenClipBoard implements ClipboardOwner {

	@Override
	public void lostOwnership(Clipboard clipboard, Transferable contents) {
		// do nothing
	}

	public void copyFactToClipBoard(MonsenFact message) {
		if ( message != null ) {
			StringSelection stringSelection = new StringSelection( message.getFact() );
			Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
			clipboard.setContents(stringSelection, this);
		}
	}
}
